/*
 * @Author: shenya
 * @Date: 2023-08-10 16:17:53
 * @Description: 任务配置js
 */

import { PET_FEEDBACK_JOB_TYPE_DICT } from '@/const/type';
export const tableOption = () => {
  return {
    ...window.$crudMixins.tableOptions,
    addBtn: false,
    editBtn: false,
    delBtn: false,
    column: [
      {
        label: '任务类型',
        prop: 'type',
        type: 'select',
        search: true,
        searchOrder: 1,
        dicData: PET_FEEDBACK_JOB_TYPE_DICT,
      },

      {
        label: '任务名称',
        prop: 'name',
        search: true,
        searchOrder: 2,
      },
      {
        label: '任务描述',
        prop: 'jobDesc',
        width: 120,
        overHidden: true,
      },
      {
        label: '领养时间节点',
        prop: 'timeSlot',
        width: 120,
      },
      {
        label: '创建时间',
        prop: 'createTime',
        width: 160,
      },
      {
        label: '友好提示',
        prop: 'tips',
        width: 120,
        overHidden: true,
      },
      {
        label: '状态',
        prop: 'status',
        dicData: [
          {
            label: '启用',
            value: '0',
          },
          {
            label: '禁用',
            value: '1',
          },
        ],
      },
    ],
  };
};
export const formOption = (action) => {
  return {
    submitBtn: false,
    emptyBtn: false,
    labelWidth: 120,
    column: [
      {
        label: '任务类型',
        prop: 'type',
        type: 'radio',
        disabled: action === 'edit',
        required: true,
        dicData: PET_FEEDBACK_JOB_TYPE_DICT,
        rules: [
          {
            required: true,
            message: '请选择任务类型',
            trigger: 'blur',
          },
        ],
      },
      {
        label: '任务名称',
        prop: 'name',
        maxlength: 20,
        row: true,
        span: 24,
        rules: [
          {
            required: true,
            message: '请输入任务名称',
            trigger: 'blur',
          },
        ],
      },
      {
        label: '领养时间节点',
        prop: 'timeSlot',
        row: true,
        formslot: true,
        span: 24,
        rules: [
          {
            required: true,
            message: '请输入领养时间节点',
            trigger: 'blur',
          },
          {
            pattern: /^[0-9]*[1-9][0-9]*$/,
            message: '领养时间只能输入正整数',
          },
        ],
      },
      {
        label: '任务描述',
        prop: 'jobDesc',
        maxlength: 30,
        showWordLimit: true,
        span: 24,
        row: true,
        rules: [
          {
            required: true,
            message: '请输入任务描述',
            trigger: 'blur',
          },
        ],
      },
      {
        label: '友好提示',
        prop: 'tips',
        maxlength: 30,
        span: 24,
        row: true,
        showWordLimit: true,
      },
      {
        label: '状态',
        prop: 'status',
        type: 'radio',
        required: true,
        span: 24,
        value: '0',
        dicData: [
          {
            label: '启用',
            value: '0',
          },
          {
            label: '禁用',
            value: '1',
          },
        ],
        rules: [
          {
            required: true,
            message: '请选择状态',
            trigger: 'blur',
          },
        ],
      },
    ],
  };
};
export const relateOption = () => {
  return {
    ...window.$crudMixins.tableOptions,
    addBtn: false,
    editBtn: false,
    delBtn: false,
    column: [
      {
        label: '问题描述',
        prop: 'questionDesc',
        search: true,
        searchSpan: 8,
      },
      {
        label: '排序',
        prop: 'sort',
      },
    ],
  };
};
